package com.chitang.controller;

import com.chitang.operation.WebsocketOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wjs
 * @CreateTime: 2023-03-10 15:50
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private WebsocketOperation websocketOperation;

    @GetMapping("/send/{id}/{msg}")
    public String send(@PathVariable("id") String id, @PathVariable("msg") String msg) {
        websocketOperation.send(id, msg);
        return "success";
    }

    @GetMapping("/sendAll/{msg}")
    public String sendAll(@PathVariable("msg") String msg) {
        websocketOperation.sendAll(msg);
        return "success";
    }
}
